# -*- coding: utf-8 -*-
# -*- frozen_string_literal: true -*-

require_relative "./prep_release"

desc "Release built gem on Rubygems"
task :release => [:tag] do
  LorcaPrepRelease.publish_gem
end

desc "Tag release commit"
task :tag => [:commit_checksum] do
  checksum_dir = File.expand_path "../../../checksum", __FILE__
  LorcaPrepRelease.tag_release_commit archive: checksum_dir
end

desc "Commit latest packed gem checksum"
task :commit_checksum => [:checksum] do
  checksum_dir = File.expand_path "../../../checksum", __FILE__
  LorcaPrepRelease.commit_checksum archive: checksum_dir
end

desc "Create checksum file for latest packed gem"
task :checksum => [:pack] do
  checksum_dir = File.expand_path "../../../checksum", __FILE__
  gem = Dir["lorca-*.gem"].first

  LorcaPrepRelease.checksum gem, archive: checksum_dir
  puts "Checksum created successfully"
end

desc "Pack gem"
task :pack => [:test] do
  LorcaPrepRelease.package
end

desc "Import EFF word list for passphrases"
task :import_eff do
  LorcaPrepRelease.import_wordlist "./dev/wordlists/eff_large_wordlist.txt",
    to: "./lib/lorca/plugins/phrases"

  puts "import successful"
end
